export function useDownload() {
  function handleRes(res: any) {
    const url = window.URL.createObjectURL(new Blob([res.data]));
    const link = document.createElement('a');
    link.href = url;
    link.setAttribute('download', '短信模板.xlsx');
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
  }
  async function downExcel() {
    await exportTicketTemplate().then((res: any) => {
      handleRes(res);
    });
  }
  return {
    handleRes,
    downExcel,
  };
}
